<html>
<head><meta charset="utf-8"><title>unstable variants for `#[non_exhaustive]` enums? · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html">unstable variants for `#[non_exhaustive]` enums?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="238578581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/unstable%20variants%20for%20%60%23%5Bnon_exhaustive%5D%60%20enums%3F/near/238578581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html#238578581">(May 13 2021 at 04:08)</a>:</h4>
<p>For an enum marked as <code>#[non_exhaustive]</code>, would it be reasonable to allow unstable enum variants? Stable code couldn't match those variants, but for a <code>#[non_exhaustive]</code> enum that seems potentially acceptable.</p>



<a name="238583265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/unstable%20variants%20for%20%60%23%5Bnon_exhaustive%5D%60%20enums%3F/near/238583265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html#238583265">(May 13 2021 at 05:29)</a>:</h4>
<p>Why not private variants as well then?</p>



<a name="238583321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/unstable%20variants%20for%20%60%23%5Bnon_exhaustive%5D%60%20enums%3F/near/238583321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html#238583321">(May 13 2021 at 05:30)</a>:</h4>
<p>I guess this is for adding things like <code>ErrorKind</code>s, Josh?</p>



<a name="238583456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/unstable%20variants%20for%20%60%23%5Bnon_exhaustive%5D%60%20enums%3F/near/238583456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html#238583456">(May 13 2021 at 05:32)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Exactly.</p>



<a name="238583795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/unstable%20variants%20for%20%60%23%5Bnon_exhaustive%5D%60%20enums%3F/near/238583795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/unstable.20variants.20for.20.60.23.5Bnon_exhaustive.5D.60.20enums.3F.html#238583795">(May 13 2021 at 05:38)</a>:</h4>
<p>I think if T-compiler says it's feasible I don't have any objections.  I assume y'all on libs will figure out the implications of making it impossible to directly match a variant that someone cares about.</p>
<p>(We used to have fake-unstable variants in them anyway, just spelled <code>#[doc(hidden)] __DoNotUse(())</code>, so real-unstable doesn't seem like a foundational issue.  But I assume if it was easy to implement it would have been done instead of the underscores-and-hidden hack.)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>